package com.sczmgk.syevaluation.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.sczmgk.syevaluation.R;
import com.sczmgk.syevaluation.dialog.DialogFactory;
import com.sczmgk.syevaluation.dialog.MessageDialog;
import com.sczmgk.syevaluation.utils.SpfUtil;
import com.sczmgk.syevaluation.utils.Tools;

public class LogoutActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_logout);
        findViewById(R.id.bt_logout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               MessageDialog dialog = DialogFactory.chooseDialog(LogoutActivity.this, "确定要退出登录吗？", "确定", "取消", new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        SpfUtil.setLoginStatus(LogoutActivity.this,false);
                        Intent intent = new Intent(LogoutActivity.this,LoginActivity.class);
                        startActivity(intent);
                        finish();
                    }
                }, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {

                    }
                });
               dialog.show();

            }
        });

     TextView version=  findViewById(R.id.tv_version);
     version.setText("版本号："+ Tools.getAppVersionName(this));
    }
}
